package com.example.backblog.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.ClusterServersConfig;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RedissonConfig {
    @Bean
    public RedissonClient redissonClient(){
        // Redisson配置
        Config config = new Config();

        ClusterServersConfig clusterServersConfig = config.useClusterServers();
        clusterServersConfig.addNodeAddress(
                "redis://192.168.65.162:6379",
                "redis://192.168.182.219:6379",
                "redis://192.168.182.225");
        // 创建RedissonClient实例
        RedissonClient redisson = Redisson.create(config);
        return redisson;
    }
}
